package com.zlzlib.okhttp.xml;

/**
 * soap 协议的请求根节点
 *
 * @DateTime: 2020/4/27 11:02
 * @Author zlz
 * @Version 1.0
 */
public class SoapEnvelope extends BaseEnvelope {

    /**
     * <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://banyan.doc.web.com/webservice">
     * <soapenv:Header/>
     * <soapenv:Body>
     * .......
     * </soapenv:Body>
     * </soapenv:Envelope>
     * <p>
     *
     * @param nameSpace 命名空间
     */
    public SoapEnvelope(String nameSpace) {
        super();
        root = new BaseXmlContent("soapenv:Envelope");
        root.addAttribute("xmlns:soapenv", "http://schemas.xmlsoap.org/soap/envelope/")
                .addAttribute("xmlns:web", nameSpace);
        head = new BaseXmlContent("soapenv:Header");
        body = new BaseXmlContent("soapenv:Body");
        root.addValue(head).addValue(body);
    }

    public SoapEnvelope(String nameKey, String nameSpace) {
        super();
        root = new BaseXmlContent("soapenv:Envelope");
        root.addAttribute("xmlns:soapenv", "http://schemas.xmlsoap.org/soap/envelope/")
                .addAttribute(nameKey, nameSpace);
        head = new BaseXmlContent("soapenv:Header");
        body = new BaseXmlContent("soapenv:Body");
        root.addValue(head).addValue(body);
    }

}
